#include<bits/stdc++.h>
using namespace std;

int mostFrequentEven(vector<int>& nums)
{
    unordered_map<int, int> cnt;
    for(auto i:nums)
        if(i%2 == 0)
            cnt[i]++;
    
    if(cnt.empty())
        return -1;

    int ans = 0, mx = 0;
    for(auto i = cnt.begin();i != cnt.end();i++)
    {
        if(i->second > mx)
            ans = i->first, mx = i->second;
        if(i->second == mx && i->first < ans)
            ans = i->first;
    }
    return ans;
}

int main()
{
	vector<int> nums;
	int x;
	while(cin>>x)
		nums.push_back(x);
	cout<<mostFrequentEven(nums);
	return 0;
}

